package com.ruoyi.yljf.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.yljf.mapper.JingfangNoticeMapper;
import com.ruoyi.yljf.domain.JingfangNotice;
import com.ruoyi.yljf.service.IJingfangNoticeService;

import javax.annotation.Resource;

/**
 * 经方笔记Service业务层处理
 * 
 * @author metaee
 * @date 2025-03-26
 */
@Service
public class JingfangNoticeServiceImpl extends ServiceImpl<JingfangNoticeMapper, JingfangNotice> implements IJingfangNoticeService {
    @Resource
    private JingfangNoticeMapper jingfangNoticeMapper;
    
    /**
     * 查询经方笔记列表
     * 
     * @param jingfangNotice 经方笔记
     * @return 经方笔记
     */
    @Override
    public List<JingfangNotice> selectJingfangNoticeList(JingfangNotice jingfangNotice) {
    	LambdaQueryWrapper<JingfangNotice> queryWrapper = Wrappers.lambdaQuery();
        if (StringUtils.isNotNull(jingfangNotice.getUserId())) {
			queryWrapper.eq(JingfangNotice::getUserId, jingfangNotice.getUserId());
		}
        if (StringUtils.isNotEmpty(jingfangNotice.getUserName())) {
			queryWrapper.like(JingfangNotice::getUserName, jingfangNotice.getUserName());
		}
        if (StringUtils.isNotEmpty(jingfangNotice.getAvatar())) {
			queryWrapper.eq(JingfangNotice::getAvatar, jingfangNotice.getAvatar());
		}
        if (StringUtils.isNotNull(jingfangNotice.getCurId())) {
			queryWrapper.eq(JingfangNotice::getCurId, jingfangNotice.getCurId());
		}
        if (StringUtils.isNotEmpty(jingfangNotice.getName())) {
			queryWrapper.like(JingfangNotice::getName, jingfangNotice.getName());
		}
        if (StringUtils.isNotEmpty(jingfangNotice.getNoticeContent())) {
			queryWrapper.eq(JingfangNotice::getNoticeContent, jingfangNotice.getNoticeContent());
		}
        if (StringUtils.isNotNull(jingfangNotice.getLikes())) {
			queryWrapper.eq(JingfangNotice::getLikes, jingfangNotice.getLikes());
		}
        if (StringUtils.isNotNull(jingfangNotice.getCreatTime())) {
			queryWrapper.eq(JingfangNotice::getCreatTime, jingfangNotice.getCreatTime());
		}
        return jingfangNoticeMapper.selectList(queryWrapper);
    }
}
